OSGEventHandler Class Reference

#include <OSGEventHandler.h>

List of all members.

Public Member Functions

 OSGEventHandler (osg::ref_ptr< osgProducer::Viewer > viewer, CMainFrame *newFrame)
 ~OSGEventHandler ()
bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
void drawVehicleDodge (const osgGA::GUIEventAdapter &ea)
void drawVehicleSemi (const osgGA::GUIEventAdapter &ea)
void drawSign (const osgGA::GUIEventAdapter &ea)
void drawLight (const osgGA::GUIEventAdapter &ea)
void drawTree (const osgGA::GUIEventAdapter &ea)
void drawBuilding (const osgGA::GUIEventAdapter &ea)
void select (const osgGA::GUIEventAdapter &ea)
void roadPick (const osgGA::GUIEventAdapter &ea)
bool drawRoad (const osgGA::GUIEventAdapter &ea)
bool rightClickMenu (const osgGA::GUIEventAdapter &ea)
void drag (TraffEduObject *dragObject, const osgGA::GUIEventAdapter &ea)
void calculateNewPosition (const osgGA::GUIEventAdapter &ea)
void calculateOldPosition (const osgGA::GUIEventAdapter &ea)

Private Attributes

DrawMode drawMode
osg::ref_ptr< osgProducer::Viewer > _viewer
CMainFrame * frame
TraffEduObject * dragObject
boolean defaultMouse
boolean rightMenu
osg::Vec3 old_position
osg::Vec3 new_position
TraffEduObject * translatedObj


Detailed Description

The OSGEventHandler is the class responsible from the callbacks of OSGWindow, RightView. This class is highly works together with, the classes in GUIEventHandler Module and Rightiew class. For each undoable operation of the user, OSGEventHandler class is responsible to inform of the operation to GUIEventHandler. For RightClick menu operations it informs the RightView class to pop up the appropriate rigth click menu. (ie. if right-click on an object, ObjectMenu; if on an empty place, FreeMenu, is popped-up.) Main user operations OSGEventHandler class deals are as follows; 1. Creation of any object to any place. 2. Drag & Drop operations of any object. 3. Selection and Deselection of any object, and multiple objects. 4. Poping Up suitable RigthClick Menus.

Definition at line 13 of file OSGEventHandler.h.


Constructor & Destructor Documentation

OSGEventHandler::OSGEventHandler (  osg::ref_ptr< osgProducer::Viewer >  viewer,
CMainFrame *  newFrame
)  [inline]
 

Constructor for the OSGEventHandler class.

Parameters:
viewer under which viewer the OSGEventHandler works.
newFrame under which CMainFrame the OSGEventHandler works.

Definition at line 32 of file OSGEventHandler.h.

References defaultMouse, frame, and rightMenu.

OSGEventHandler::~OSGEventHandler (   )  [inline]
 

Destructor for the OSGEventHandler class.

Definition at line 39 of file OSGEventHandler.h.


Member Function Documentation

void OSGEventHandler::calculateNewPosition (  const osgGA::GUIEventAdapter &  ea  ) 
 

Responsible from the execute/undo opearion of a translate.

Parameters:
ea a variable of type osgGA::GUIEventAdapter&

Definition at line 16 of file OSGEventHandler.cpp.

References _viewer, and new_position.

Referenced by handle().

void OSGEventHandler::calculateOldPosition (  const osgGA::GUIEventAdapter &  ea  ) 
 

Responsibe from the execute/undo opearion of a translate.

Parameters:
ea a variable of type osgGA::GUIEventAdapter&

Definition at line 29 of file OSGEventHandler.cpp.

References _viewer, and old_position.

void OSGEventHandler::drag (  TraffEduObject *  dragObject,
const osgGA::GUIEventAdapter &  ea
) 
 

Drags the selected object.

Parameters:
dragObject object in drag mode
ea a variable of type osgGA::GUIEventAdapter&, to get from which points the object will pass through.

Definition at line 41 of file OSGEventHandler.cpp.

References _viewer, dragFlag, TraffEduObject::getPAT(), OSGWindows::getSelectedObjects(), and osgwind.

void OSGEventHandler::drawBuilding (  const osgGA::GUIEventAdapter &  ea  ) 
 

Draws the Environmental Object Building.

Parameters:
ea a variable of type osgGA::GUIEventAdapter&, to get where to create the building.

Definition at line 114 of file OSGEventHandler.cpp.

References _viewer, OSGWindows::addCommandInsertEnvObj(), and osgwind.

void OSGEventHandler::drawLight (  const osgGA::GUIEventAdapter &  ea  ) 
 

Draws the Traffic Light.

Parameters:
ea a variable of type osgGA::GUIEventAdapter&, to get where to create the light.

Definition at line 84 of file OSGEventHandler.cpp.

References _viewer, OSGWindows::addCommandInsertTrafficLight(), frame, and osgwind.

bool OSGEventHandler::drawRoad (  const osgGA::GUIEventAdapter &  ea  ) 
 

Draws the Road, in association with the roadPick.

Parameters:
ea a variable of type osgGA::GUIEventAdapter&, to get from which points the road will pass through.

Definition at line 149 of file OSGEventHandler.cpp.

References frame, and roadPick().

void OSGEventHandler::drawSign (  const osgGA::GUIEventAdapter &  ea  ) 
 

Draws the Traffic Sign.

Parameters:
ea a variable of type osgGA::GUIEventAdapter&, to get where to create the sign.

Definition at line 166 of file OSGEventHandler.cpp.

References _viewer, OSGWindows::addCommandInsertTrafficSign(), frame, and osgwind.

void OSGEventHandler::drawTree (  const osgGA::GUIEventAdapter &  ea  ) 
 

Draws the Environmental Object Tree.

Parameters:
ea a variable of type osgGA::GUIEventAdapter&, to get where to create the tree.

Definition at line 99 of file OSGEventHandler.cpp.

References _viewer, OSGWindows::addCommandInsertEnvObj(), and osgwind.

void OSGEventHandler::drawVehicleDodge (  const osgGA::GUIEventAdapter &  ea  ) 
 

Draws the Vehicle Dodge.

Parameters:
ea a variable of type osgGA::GUIEventAdapter&, to get where to create the vehicle.

Definition at line 182 of file OSGEventHandler.cpp.

References _viewer, OSGWindows::addCommandInsertVehicle(), and osgwind.

void OSGEventHandler::drawVehicleSemi (  const osgGA::GUIEventAdapter &  ea  ) 
 

Draws the Vehicle Semi.

Parameters:
ea a variable of type osgGA::GUIEventAdapter&, to get where to create the vehicle.

Definition at line 197 of file OSGEventHandler.cpp.

References _viewer, OSGWindows::addCommandInsertVehicle(), and osgwind.

bool OSGEventHandler::handle (  const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  us
) 
 

Main function in the OSGEventHandler class to deal with the users mouse and Keyboard actions.

Parameters:
ea a variable of type osgGA::GUIEventAdapter& telling which action occured.
us osgGA::GUIActionAdapter&
Returns:
operation success.

Definition at line 352 of file OSGEventHandler.cpp.

References OSGWindows::addCommandTranslate(), calculateNewPosition(), defaultMouse, dragFlag, dragObject, DRAW_ROAD, frame, OSGWindows::getCurrentFrameId(), new_position, old_position, osgwind, rightClickMenu(), rightMenu, SELECT, and translatedObj.

bool OSGEventHandler::rightClickMenu (  const osgGA::GUIEventAdapter &  ea  ) 
 

Pops-up rightClick menus.

Parameters:
ea a variable of type osgGA::GUIEventAdapter&, to get where to pop-up the right-click menu.

Definition at line 215 of file OSGEventHandler.cpp.

References OSGWindows::addCommandDeselectAll(), dragFlag, frame, OSGWindows::getSelectedObjects(), osgwind, rightMenu, and SELECT.

Referenced by handle().

void OSGEventHandler::roadPick (  const osgGA::GUIEventAdapter &  ea  ) 
 

Gets the Road control points.

Parameters:
ea a variable of type osgGA::GUIEventAdapter&, to get from which points the road will pass through.

Definition at line 130 of file OSGEventHandler.cpp.

References _viewer, RoadMap::addPoint(), RoadMap::getLastRoadIndex(), RoadMap::setActiveRoadIndex(), and theRoadMap.

Referenced by drawRoad().

void OSGEventHandler::select (  const osgGA::GUIEventAdapter &  ea  ) 
 

Selects (ie. highlights) object..

Parameters:
ea a variable of type osgGA::GUIEventAdapter&, to get where an action of selection occured.

Definition at line 308 of file OSGEventHandler.cpp.

References _viewer, OSGWindows::addCommandSelect(), and osgwind.


Member Data Documentation

osg::ref_ptr<osgProducer::Viewer> OSGEventHandler::_viewer [private]
 

Definition at line 16 of file OSGEventHandler.h.

Referenced by calculateNewPosition(), calculateOldPosition(), drag(), drawBuilding(), drawLight(), drawSign(), drawTree(), drawVehicleDodge(), drawVehicleSemi(), roadPick(), and select().

boolean OSGEventHandler::defaultMouse [private]
 

Definition at line 19 of file OSGEventHandler.h.

Referenced by handle(), and OSGEventHandler().

TraffEduObject* OSGEventHandler::dragObject [private]
 

Definition at line 18 of file OSGEventHandler.h.

Referenced by handle().

DrawMode OSGEventHandler::drawMode [private]
 

Definition at line 15 of file OSGEventHandler.h.

CMainFrame* OSGEventHandler::frame [private]
 

Definition at line 17 of file OSGEventHandler.h.

Referenced by drawLight(), drawRoad(), drawSign(), handle(), OSGEventHandler(), and rightClickMenu().

osg::Vec3 OSGEventHandler::new_position [private]
 

Definition at line 23 of file OSGEventHandler.h.

Referenced by calculateNewPosition(), and handle().

osg::Vec3 OSGEventHandler::old_position [private]
 

Definition at line 22 of file OSGEventHandler.h.

Referenced by calculateOldPosition(), and handle().

boolean OSGEventHandler::rightMenu [private]
 

Definition at line 20 of file OSGEventHandler.h.

Referenced by handle(), OSGEventHandler(), and rightClickMenu().

TraffEduObject* OSGEventHandler::translatedObj [private]
 

Definition at line 24 of file OSGEventHandler.h.

Referenced by handle().


The documentation for this class was generated from the following files:
Generated on Sun May 28 18:54:13 2006 for TraffEdu by  doxygen 1.4.6-NO